import React, { useState } from 'react'
import '../css/leaving.css'
import { Input } from 'antd'
const { TextArea } = Input

export default function Leaving() {
  const [name, setname] = useState('')
  const [company, setcompany] = useState('')
  const [mail, setmail] = useState('')
  const [phone, setphone] = useState('')
  const [communication, setcommunication] = useState('')
  const [value, setValue] = useState('')
  function postdata() {
    if (name === '' && company === '' && mail === '' && phone === '' && communication === '' && value === '') {
      console.log('qqqq')
      alert('请把信息补充完整')
    } else {
      alert('提交成功')
      setname('')
      setcompany('')
      setmail('')
      setphone('')
      setcommunication('')
      setValue('')
    }
  }
  return (
    <div className="j_leav">
      <div className="j_leav_title">
        <p>首页&gt;&gt;在线留言</p>
      </div>
      <div className="j_leacv_top">在线留言</div>
      <div className="j_leacv_left">
        <div className="j_leav_from">请在下面填写完全信息</div>
        <div className="j_leav_from_list">
          <div className="j_leav_list_left">
            <span>您的姓名：</span>
            <Input
              value={name}
              onChange={(e) => {
                setname(e.target.value)
              }}
              placeholder="请输入你的名字"
            />
          </div>
          <div className="j_leav_list_left">
            <span>公司名称：</span>
            <Input
              value={company}
              onChange={(e) => {
                setcompany(e.target.value)
              }}
              placeholder="请输入公司名称"
            />
          </div>
        </div>
        <div className="j_leav_from_list">
          <div className="j_leav_list_left">
            <span>发送邮件：</span>
            <Input
              value={mail}
              onChange={(e) => {
                setmail(e.target.value)
              }}
              placeholder="请输入想发的信息"
            />
          </div>
          <div className="j_leav_list_left">
            <span>联系方式：</span>
            <Input
              value={phone}
              onChange={(e) => {
                setphone(e.target.value)
              }}
              placeholder="请输入你的电话"
            />
          </div>
        </div>
        <div className="j_leav_from_list">
          <div className="j_leav_list_left">
            <span>QQ：</span>
            <Input
              value={communication}
              onChange={(e) => {
                setcommunication(e.target.value)
              }}
              placeholder="请输入你的QQ"
            />
          </div>
        </div>
        <div className="j_leav_conts">
          <TextArea value={value} onChange={(e) => setValue(e.target.value)} placeholder="请输入内容" autoSize={{ minRows: 3, maxRows: 5 }} className="j_text_ares" />
        </div>
        <div className="j_bottom_ong" onClick={postdata.bind()}>
          发送留言
        </div>
      </div>
    </div>
  )
}
